﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Kokomo.Lexical.Expressions;

namespace Kokomo.PeInspector.Reflection.Query
{
	class GroupByClause : DependentClause
	{
		public TypedVariable RangeVariable { get; private set; }
		public Expression KeyExpression { get; private set; }
		public TypedVariable GroupVariable { get; set; }

		public GroupByClause(
			QueryClause source,
			TypedVariable rangeVariable,
			Expression keyExpression,
			TypedVariable groupVariable = null
			)
			: base(source)
		{
			if (rangeVariable == null) throw new ArgumentNullException("rangeVariable");
			if (keyExpression == null) throw new ArgumentNullException("keyExpression");
			//if (groupVariable == null) throw new ArgumentNullException("groupVariable");

			this.RangeVariable = rangeVariable;
			this.KeyExpression = keyExpression;
			this.GroupVariable = groupVariable;
		}
	}
}
